<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLoginRecordTable extends Migration{

    public function up(){
        /**
         * 企业突访记录表
         */
        Schema::create('company_visit_record', function (Blueprint $table) {
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属企业用户ID');
            $table->timestamp('company_login_time')->nullable()->comment('突访记录时间');
            $table->string('company_login_ip')->default('')->comment('突访登陆ip');
            $table->tinyInteger('login_type')->unsigned()->default(0)->comment('突访登陆类型(1为PC注册2为PC登录3为Mob注册4为Mob登录)');
            $table->tinyInteger('type')->unsigned()->default(0)->comment('企业用户突访登陆类型(1为普通2为QQ3为微信)');
        });
        /**
         * 企业登录记录表
         */
        Schema::create('company_login_record', function (Blueprint $table) {
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属企业用户ID');
            $table->timestamp('company_login_time')->nullable()->comment('企业登录时间');
            $table->string('company_login_ip')->default('')->comment('企业登陆ip');
            $table->tinyInteger('login_type')->unsigned()->default(0)->comment('企业登录类型(1为PC注册2为PC登录3为Mob注册4为Mob登录)');
            $table->tinyInteger('type')->unsigned()->default(0)->comment('企业用户登陆类型(1为普通2为QQ3为微信)');
        });
        /**
         * 个人登录记录表
         */
        Schema::create('personal_login_record', function (Blueprint $table) {
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属个人用户ID');
            $table->timestamp('personal_login_time')->nullable()->comment('个人登录时间');
            $table->string('personal_login_ip')->default('')->comment('个人登陆ip');
            $table->tinyInteger('login_type')->unsigned()->default(0)->comment('个人登录类型(1为PC注册2为PC登录3为Mob注册4为Mob登录)');
            $table->tinyInteger('type')->unsigned()->default(0)->comment('个人用户登陆类型(1为普通2为QQ3为微信)');
        });
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down(){
        Schema::dropIfExists('company_visit_record');
        Schema::dropIfExists('company_login_record');
        Schema::dropIfExists('personal_login_record');
    }
}
